package com.tsingteng.cosfun.ui.message.officalnotification;

import android.util.Log;

import com.tsingteng.cosfun.bean.NotificationBean;
import com.tsingteng.cosfun.bean.SystemNotificationBean;
import com.tsingteng.cosfun.callback.RxObserver;
import com.tsingteng.cosfun.mvp.presenter.BasePresenter;
/**
 * 官方助手P层
 * 常胜
 * 2018.8.15
 * */
public class OfficalPresenter extends BasePresenter implements OfficalNotificationContract.IOfficalPresenter {

    private final OfficalModel officalModel;
    private OfficalNotificationContract.IOfficalView view;
    public OfficalPresenter(){
        officalModel = new OfficalModel();
    }
    @Override
    public void loginOfficalData(String type, int page) {
        view = (OfficalNotificationContract.IOfficalView) getView();
        RxObserver<SystemNotificationBean> rxObserver = new RxObserver<SystemNotificationBean>(this) {
            @Override
            protected void onFaile(int errorCode, String errorMsg) {
            }

            @Override
            protected void onSuccess(SystemNotificationBean notificationBean) {
                view.showOfficalData(notificationBean);
            }
        };
        officalModel.getOfficalNotification(type,page,rxObserver);
        addDisposable(rxObserver);
    }
}
